package com.wang.strategy;

public class Strategy {
    private PayStrategy payStrategy;
    public void PayStrategy(PayStrategy payStrategy){
        this.payStrategy = payStrategy;
    }

    public void pay(){
        payStrategy.pay();
    }

    public static void main(String[] args) {
        Strategy strategy = new Strategy();
        strategy.PayStrategy(new WXPayStrategy());
        strategy.pay();
    }
}

interface PayStrategy{
    void pay();
}

class WXPayStrategy implements PayStrategy{

    @Override
    public void pay() {
        System.out.println("微信支付……");
    }
}

class ZFBPayStrategy implements PayStrategy{

    @Override
    public void pay() {
        System.out.println("支付宝支付……");
    }
}

class YLPayStrategy implements PayStrategy{

    @Override
    public void pay() {
        System.out.println(" 银联支付……");
    }
}


